﻿using IOA.MES.Log.DataAccess.Enum;
using System;

namespace IOA.MES.Log.DataAccess.VModel
{
    /// <summary>
    /// 登录记录
    /// </summary>
    public class VLoginHistory : BaseVModel
    {
        private string _clientIP = string.Empty;
        private string _userAgent;

        #region Public Property

        ///<Summary>
        /// 用户ID
        ///</Summary>
        public int UserId { get; set; }

        ///<Summary>
        /// 登录时间
        ///</Summary>
        public DateTime LoginTime { get; set; }

        ///<Summary>
        /// 设备类型
        ///</Summary>
        public Enum.DeviceType DeviceType { get; set; }
        public string CNDeviceType { get { return !System.Enum.IsDefined(typeof(DeviceType), DeviceType) ? string.Empty : EnumConvert.ToDesc(DeviceType); } }

        ///<Summary>
        /// 客户端类型
        ///</Summary>
        public Enum.ClientType ClientType { get; set; }
        public string CNClientType { get { return !System.Enum.IsDefined(typeof(ClientType), ClientType) ? string.Empty : EnumConvert.ToDesc(ClientType); } }

        ///<Summary>
        /// 客户端IP
        ///</Summary>
        public string ClientIP
        {
            get { return string.IsNullOrWhiteSpace(_clientIP) ? string.Empty : _clientIP; }
            set { _clientIP = value; }
        }

        ///<Summary>
        /// 客户端信息
        ///</Summary>
        public string UserAgent
        {
            get { return string.IsNullOrWhiteSpace(_userAgent) ? string.Empty : _userAgent; }
            set { _userAgent = value; }
        }
        #endregion
    }
}
